﻿using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using YFurion.Application;

namespace UpperComputer.Application
{
    public class BaseUserDto : EntityDto
    {
        public BaseUserDto()
        {
            BaseRoleUser = new List<BaseRoleUserDto>();
        }

        [Required(ErrorMessage = "用户账号不能为空"), RegularExpression(@"^[a-zA-Z]{1,50}$", ErrorMessage = "用户账号格式不正确")]
        public string Account { get; set; }

        [Required(ErrorMessage = "用户名称不能为空"), StringLength(50, ErrorMessage = "用户名称不能超过50个字符")]
        public string DisplayName { get; set; }

        [Range(0, 2, ErrorMessage = "性别必须在0-2之间")]
        public byte Sex { get; set; }

        [StringLength(100, ErrorMessage = "头像不能超过100个字符")]
        public string Photo { get; set; } = string.Empty;

        public bool IsActive { get; set; }

        [StringLength(255, ErrorMessage = "描述不能超过255个字符")]
        public string Description { get; set; }

        public IFormFile File { get; set; }

        public ICollection<BaseRoleUserDto> BaseRoleUser { get; set; }
    }
}
